﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Supermarket;

namespace XLSupermarket.Cashier.VIP
{
    public partial class Select_VIP : Form
    {
        public Select_VIP()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string sel = "VIP_ID = '";
            if (TB_ID.Text.Length>8)
            {
                sel = "VIP_TEL='";
            }
            string sql = "select VIP_ID ID,VIP_Name Name,VIP_time Time,VIP_TEL TEL,VIP_Score Score from VIP_information where "+sel + TB_ID.Text + "' ";
            DataTable dt = DBHelper.FillData(sql);
            if (dt.Rows.Count > 0)
            {
                LB_ID.Text = dt.Rows[0]["ID"].ToString();
                LB_Name.Text = dt.Rows[0]["Name"].ToString();
                DateTime time = DateTime.Parse(dt.Rows[0]["Time"].ToString());
                LB_Date.Text = time.ToString("yyyy-MM-dd");
                LB_Phone.Text = dt.Rows[0]["TEL"].ToString();
                LB_Score.Text = dt.Rows[0]["Score"].ToString();
            }
            else
            {
                LB_ID.Text = "";
                LB_Name.Text = "";
                LB_Date.Text = "";
                LB_Phone.Text = "";
                LB_Score.Text = "";
                MessageBox.Show("暂时无该会员！","提示",MessageBoxButtons.OK);
            }
        }
    }
}
